import 'package:fish_redux/fish_redux.dart';
import 'package:kunlun_gas/app_files.dart';

class MachineOrderModel {
  final String lateFee;
  final String arrearsFee;
  final String balance;
  final String lastRecordTime;
  final String lastPointNumber;
  final String meterFactory;
  final String gasMeterNo;

  const MachineOrderModel({
    this.lastPointNumber,
    this.lateFee,
    this.arrearsFee,
    this.balance,
    this.lastRecordTime,
    this.meterFactory,
    this.gasMeterNo,
  });
}

class MachineOrderItemModel {
  final String orderTime;
  final String orderMoney;
  final String orderGas;
  final String chargeFee;

  const MachineOrderItemModel({
    this.orderGas,
    this.orderMoney,
    this.orderTime,
    this.chargeFee,
  });

  static fromJson(json) {
    return MachineOrderItemModel(
      orderGas: CommonUtils.checkNullToString(json['BillGasCubic']),
      orderMoney: CommonUtils.checkNullToString(json['BillTotalFee']),
      orderTime: CommonUtils.checkNullToString(json['BillAddTime']),
      chargeFee: CommonUtils.checkNullToString(json['BillChargeFee']),
    );
  }
}

class MachineOrderViewState implements Cloneable<MachineOrderViewState> {
  String userID;
  String startTime;
  String endTime;
  MachineOrderModel model;
  List<MachineOrderItemModel> items;
  EasyRefreshController refreshController = EasyRefreshController();
  int currentPage = 1;

  @override
  MachineOrderViewState clone() {
    return MachineOrderViewState()
      ..userID = userID
      ..startTime = startTime
      ..endTime = endTime
      ..refreshController = refreshController
      ..currentPage = currentPage
      ..items = items
      ..model = model;
  }
}

MachineOrderViewState initState(Map<String, dynamic> args) {
  return MachineOrderViewState()..userID = args['userID'];
}
